package sxh.springMvc;



import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import sxh.mybatis.dao.User;
import sxh.mybatis.dao.UserMapper;
import sxh.service.CacheService;


@Controller
public class testMyCache {
	@Autowired
	public CacheService cacheService;
	@RequestMapping(value = "testMyCache")
	@ResponseBody
	public Map<String,Object> sayHello(@RequestParam(value="vclid") String vclId) {
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		Map<String,Object>map=new HashMap<String,Object>();
		map.put("vclid",vclId);
		String result=cacheService.getData(map);
		map.put("result",result);
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		return map;
	}
	@RequestMapping(value = "testMyCache1")
	@ResponseBody
	public Map<String,Object> testMyCache1(@RequestParam(value="vclid") String vclId) {
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		Map<String,Object>map=new HashMap<String,Object>();
		map.put("vclid",vclId);
		String result=cacheService.getData(vclId);
		map.put("result",result);
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		return map;
	}
	
	@RequestMapping(value = "testMyCacheUpdate")
	@ResponseBody
	public Map<String,Object> testMyCacheUpdate(@RequestParam(value="vclid") String vclId) {
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		Map<String,Object>map=new HashMap<String,Object>();
		map.put("vclid",vclId);
		String result=cacheService.getDataUpdate(map);
		map.put("result",result);
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		return map;
	}
	@RequestMapping(value = "testMyCacheUpdate1")
	@ResponseBody
	public Map<String,Object> testMyCacheUpdate1(@RequestParam(value="vclid") String vclId) {
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		Map<String,Object>map=new HashMap<String,Object>();
		map.put("vclid",vclId);
		String result=cacheService.getDataUpdate1(vclId);
		map.put("result",result);
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		return map;
	}
	
	@RequestMapping(value = "testMyCacheRemove")
	@ResponseBody
	public Map<String,Object> testMyCacheRemove(@RequestParam(value="vclid") String vclId) {
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		Map<String,Object>map=new HashMap<String,Object>();
		map.put("vclid",vclId);
		String result=cacheService.remove(vclId);
		map.put("result",result);
		System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		return map;
	}
}
